﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using log4net;
using YogaDictionary.Common;
using YogaDictionary.Model;
using YogaDictionary.View;

namespace YogaDictionary.ViewModel
{
    static class ViewModelWindowsManager
    {
        static private readonly List<Window> WindowsList = new List<Window>();

        static internal void ShowNewDefinitionWindow(Word word)
        {
            Log.Debug("Show new Definition for: " + word);
            var mainWindow = Application.Current.MainWindow;
            var window = new WordWindow
            {
                DataContext = new ViewModelWord(word),
                Left = mainWindow.Left + mainWindow.ActualWidth
            };

            window.Show();

            WindowsList.Add(window);
        }

        static public void RemoveWindowFromTheList(Window window)
        {
            WindowsList.Remove(window);
        }

    }
}
